package cn.zn.modules.money.his.entity.vo;

import lombok.Data;

import java.math.BigDecimal;

@Data
public class MoneyInfoSumVO {
    private String moneyTypeCode;
    private String projectCode;
    private String cateCode;
    private Double totalMoney;
    private Double stopMoney;
    private Double freezsMoney;
    private Double useMoney;
    private String moneyTypeName;
    private String projectName;
    private String cateName;
    private Integer ap;

    /**
     * 可用金额
     *
     * @return
     */
    public Double getAvailableMoney() {
        BigDecimal bd_total = new BigDecimal(this.totalMoney.toString());
        BigDecimal bd_stop = new BigDecimal(this.stopMoney.toString());
        BigDecimal bd_freezs = new BigDecimal(this.freezsMoney == null ? "0" : this.freezsMoney.toString());
        BigDecimal bd_use = new BigDecimal(this.useMoney == null ? "0" : this.useMoney.toString());
        return bd_total.subtract(bd_stop).subtract(bd_freezs).subtract(bd_use).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
}
